package com.tiance.demo;

import com.tiance.demo.ui.MainPane;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.text.Font;
import javafx.stage.Stage;

public class MysqlApplication extends Application {

    @Override
    public void start(Stage stage) throws Exception {

        MainPane sp = new MainPane();

        stage.setTitle("MySQL Data Structure");
        Scene scene = new Scene(sp, 300, 275);

        loadDefaultCSS(scene);
        loadDefaultFont();

        scene.getStylesheets().add("root");
        stage.setMinWidth(800);
        stage.setMinHeight(600);
        stage.setScene(scene);
        stage.setMaximized(true);

//        stage.getIcons().add(new Image(MysqlApplication.class.getClassLoader().getResourceAsStream("锤子.jpg")));
        stage.show();
    }

    private void loadDefaultCSS(Scene scene) {
        scene.getStylesheets().add(MysqlApplication.class.getClassLoader().getResource("main.css").toExternalForm());
    }

    private void loadDefaultFont() {
        Font font = Font.loadFont(MysqlApplication.class.getClassLoader().getResourceAsStream("FZYouSJJW_504L.TTF"), 12);
        System.out.println(font.getName());
    }

    public static void main(String[] args) {
        launch(args);
    }
}
